module Global  {
	export class globalVar {

        //声效开关
		public IsSound:boolean;
		public bg_sound: egret.Sound;
        public bg_channel: egret.SoundChannel;
        public bg_pauseTime: number;
		//玩家关卡、得分数据		
		public OpenDataKeys: {
			InitKey: "FlySim",
			Grade: "20181018",
			LevelKey: "reachlevel",
			ScoreKey: "0", 
		};
		public initobj = {"LevelPTS":[
                {"aircraft":"10","landed":"0","bestlanded": "0"},
                {"aircraft":"20","landed":"0","bestlanded": "0"},
                {"aircraft":"25","landed":"0","bestlanded": "0"},
                {"aircraft":"25","landed":"0","bestlanded": "0"},
                {"aircraft":"25","landed":"0","bestlanded": "0"},
                {"aircraft":"28","landed":"0","bestlanded": "0"},
                {"aircraft":"30","landed":"0","bestlanded": "0"},
                {"aircraft":"35","landed":"0","bestlanded": "0"},
                {"aircraft":"35","landed":"0","bestlanded": "0"},
                {"aircraft":"35","landed":"0","bestlanded": "0"},
                {"aircraft":"35","landed":"0","bestlanded": "0"},
                {"aircraft":"35","landed":"0","bestlanded": "0"}
            ]};
		public airplaneList;
		public levelsList;
		public version: string;		
		public showTut: boolean;
		public GameState: string;
		public curLevel: number;
		public Score: number;
		public BestScore: number
		
		public landedTextDisplay: string; //landed display text
		public scoreTextDisplay: string; //score display text

		public drawStrokeStyle: number; //drawing stroke number
		public drawStrokeColor: string; //drawing stroke color
		public drawStrokeAlpha: number;  //drawing stroke alpha
		public strokeStyle: number;  //default stroke number
		public strokeColor: string; //default stroke color
		public strokeAlpha: number; //default stroke alpha
		public lostStrokeStyle: number;  //default stroke number
		public lostStrokeColor: string; //default stroke color
		public lostStrokeAlpha: number; //default stroke alpha

		public autoLandPath: boolean; //enable to draw auto path for landing zone;
		public selectTitleText: string; //select level page title	
		public levelCompletedText: string; //level complete display text		
		public exitMessage: string; //go to main page message

		public resultCompleteText: string; //result complete text display
		public resultFailText: string;  //result fail text display
		public resultScoreText: string;  //result score text display

		//Social share, [SCORE] will replace with game score
		public shareEnable: boolean //toggle share
		public shareText: string; //social share message
		public shareTitle: string;//social share score title
		public shareMessage: string; //social share score message

		public constructor() {
			this.IsSound = true;
			this.bg_pauseTime = 0;
			this.version = "0.9";
			this.showTut = true;
			this.GameState = "logo";
			this.curLevel = 1;
			this.Score = 0;
			this.BestScore = 0;
			this.landedTextDisplay = '着陆: [NUMBER]/[TOTAL]'; //landed display text
			this.scoreTextDisplay = '[NUMBER]PTS'; //score display text

			this.drawStrokeStyle = 4; //drawing stroke number
			this.drawStrokeColor = '#fff'; //drawing stroke color
			this.drawStrokeAlpha = 1;  //drawing stroke alpha
			this.strokeStyle = 2;  //default stroke number
			this.strokeColor = '#fff'; //default stroke color
			this.strokeAlpha = .5; //default stroke alpha
			this.lostStrokeStyle = 2;  //default stroke number
			this.lostStrokeColor = '#666'; //default stroke color
			this.lostStrokeAlpha = .5; //default stroke alpha

			this.autoLandPath = true; //enable to draw auto path for landing zone;
			this.selectTitleText = 'Levels'; //select level page title	
			this.levelCompletedText = 'Level Complete'; //level complete display text		
			this.exitMessage = 'Are you sure\nyou want to quit?'; //go to main page message

			this.resultCompleteText = 'Level [NUMBER] Complete'; //result complete text display
			this.resultFailText = 'Game Over';  //result fail text display
			this.resultScoreText = '[NUMBER]PTS';  //result score text display

			//Social share, [SCORE] will replace with game score
			this.shareEnable = true; //toggle share
			this.shareText = 'SHARE YOUR SCORE'; //social share message
			this.shareTitle = 'Highscore on Flight Sim Game at Level[LEVEL] is [SCORE]PTS.';//social share score title
			this.shareMessage = 'Level[LEVEL] - [SCORE]PTS is mine new highscore on Flight Sim Game! Try it now!'; //social share score message

			this.airplaneList = [{src:'item_plane1_png', width:71, height:71, radius:35, speed:1},
					{src:'item_plane2_png', width:55, height:64, radius:27, speed:1.2},
					{src:'item_helicopter1_png', width:57, height:54, radius:30, speed:1.5},
					{src:'item_plane3_png', width:71, height:72, radius:35, speed:1},
					{src:'item_plane4_png', width:60, height:46, radius:27, speed:.8},
					{src:'item_helicopter2_png', width:90, height:54, radius:35, speed:1.5},
					{src:'item_plane5_png', width:99, height:47, radius:50, speed:1.8},
					{src:'item_plane6_png', width:54, height:64, radius:25, speed:1.2},];
			this.levelsList = [
					{
						level:{src:'stage1_png', total:10, speed:0, planTimer:6},
						runway:[{x:473, y:361, rotation:0, type:0, planes:[0,1]},{x:738, y:479, rotation:0, type:1, planes:[2]},]
					},
					{
						level:{src:'stage2_png', total:20, speed:0, planTimer:6},
						runway:[{x:541, y:299, rotation:0, type:0, planes:[0]},{x:935, y:414, rotation:0, type:1, planes:[2]},{x:763, y:439, rotation:302, type:0, planes:[1]},]
					},
					{
						level:{src:'stage3_png', total:25, speed:0.1, planTimer:5},
						runway:[{x:416, y:394, rotation:0, type:0, planes:[0,1]},{x:699, y:502, rotation:0, type:1, planes:[2]},{x:895, y:299, rotation:180, type:0, planes:[7]},]
					},
					{
						level:{src:'stage4_png', total:25, speed:0.2, planTimer:4},
						runway:[{x:397, y:517, rotation:0, type:1, planes:[2]},{x:875, y:446, rotation:0, type:1, planes:[5]},{x:640, y:308, rotation:0, type:1, planes:[6]},]
					},
					{
						level:{src:'stage5_png', total:25, speed:0.2, planTimer:4},
						runway:[{x:356, y:346, rotation:346, type:0, planes:[0,1]},{x:439, y:568, rotation:0, type:1, planes:[2]},{x:906, y:542, rotation:180, type:0, planes:[7]},{x:918, y:324, rotation:196, type:0, planes:[3,4]},{x:847, y:404, rotation:0, type:1, planes:[5]},]
					},
					{
						level:{src:'stage6_png', total:28, speed:0.2, planTimer:4},
						runway:[{x:945, y:424, rotation:180, type:0, planes:[0,1]},{x:761, y:538, rotation:0, type:1, planes:[2]},{x:384, y:338, rotation:355, type:0, planes:[3,4]},{x:808, y:211, rotation:175, type:0, planes:[7]},{x:433, y:430, rotation:0, type:1, planes:[5]},]
					},
					{
						level:{src:'stage7_png', total:30, speed:0.2, planTimer:4},
						runway:[{x:230, y:451, rotation:0, type:0, planes:[0,1]},{x:460, y:566, rotation:0, type:1, planes:[2]},{x:446, y:298, rotation:58, type:0, planes:[1]},{x:905, y:269, rotation:107, type:0, planes:[3,4]},{x:982, y:335, rotation:0, type:1, planes:[5]},{x:670, y:304, rotation:0, type:1, planes:[6]},]
					},
					{
						level:{src:'stage8_png', total:35, speed:0.3, planTimer:4},
						runway:[{x:230, y:451, rotation:0, type:0, planes:[0,1]},{x:460, y:566, rotation:0, type:1, planes:[2]},{x:446, y:298, rotation:58, type:0, planes:[1]},{x:1073, y:347, rotation:180, type:0, planes:[3,4]},{x:847, y:240, rotation:0, type:1, planes:[5]},{x:847, y:487, rotation:239, type:0, planes:[4]},]
					},
					{
						level:{src:'stage9_png', total:35, speed:0.3, planTimer:4},
						runway:[{x:802, y:362, rotation:180, type:0, planes:[0,1]},]
					},
					{
						level:{src:'stage10_png', total:35, speed:0.3, planTimer:4},
						runway:[{x:482, y:360, rotation:0, type:0, planes:[3,4]},]
					},
					{
						level:{src:'stage11_png', total:35, speed:0.6, planTimer:3},
						runway:[{x:485, y:288, rotation:0, type:1, planes:[2]},{x:873, y:324, rotation:0, type:1, planes:[5]},{x:654, y:543, rotation:0, type:1, planes:[6]},]
					},
					{
						level:{src:'stage12_png', total:35, speed:0.6, planTimer:3},
						runway:[{x:814, y:471, rotation:180, type:0, planes:[7]},{x:597, y:237, rotation:54, type:0, planes:[7]},{x:488, y:514, rotation:304, type:0, planes:[7]},]
					},
					];
		}

		/**
		 * 获取实例
		 */
		static globalVar:globalVar
		static get instance(){
			if(!this.globalVar) {
				this.globalVar =  new globalVar();
			} 
			return this.globalVar;
		}
	}
}